﻿Imports System
Imports System.Globalization

Namespace System.Workflow.Activities.Rules
    Friend Class StringLiteral
        Inherits Literal
        ' Methods
        Friend Sub New(ByVal internalValue As String)
            Me.m_value = internalValue
            MyBase.m_type = GetType(String)
        End Sub

        Friend Overrides Function Equal(ByVal rhs As String) As Boolean
            Return (Me.m_value = rhs)
        End Function

        Friend Overrides Function Equal(ByVal rhs As Literal) As Boolean
            Return rhs.Equal(Me.m_value)
        End Function

        Friend Overrides Function GreaterThan() As Boolean
            Return True
        End Function

        Friend Overrides Function GreaterThan(ByVal rhs As String) As Boolean
            Return (0 < String.Compare(Me.m_value, rhs, False, CultureInfo.CurrentCulture))
        End Function

        Friend Overrides Function GreaterThan(ByVal rhs As Literal) As Boolean
            Return rhs.LessThan(Me.m_value)
        End Function

        Friend Overrides Function GreaterThanOrEqual() As Boolean
            Return True
        End Function

        Friend Overrides Function GreaterThanOrEqual(ByVal rhs As String) As Boolean
            Return (0 <= String.Compare(Me.m_value, rhs, False, CultureInfo.CurrentCulture))
        End Function

        Friend Overrides Function GreaterThanOrEqual(ByVal rhs As Literal) As Boolean
            Return rhs.LessThanOrEqual(Me.m_value)
        End Function

        Friend Overrides Function LessThan(ByVal rhs As String) As Boolean
            Return (0 > String.Compare(Me.m_value, rhs, False, CultureInfo.CurrentCulture))
        End Function

        Friend Overrides Function LessThan(ByVal rhs As Literal) As Boolean
            Return rhs.GreaterThan(Me.m_value)
        End Function

        Friend Overrides Function LessThanOrEqual(ByVal rhs As String) As Boolean
            Return (0 >= String.Compare(Me.m_value, rhs, False, CultureInfo.CurrentCulture))
        End Function

        Friend Overrides Function LessThanOrEqual(ByVal rhs As Literal) As Boolean
            Return rhs.GreaterThanOrEqual(Me.m_value)
        End Function


        ' Properties
        Friend Overrides ReadOnly Property Value As Object
            Get
                Return Me.m_value
            End Get
        End Property


        ' Fields
        Private m_value As String
    End Class
End Namespace

